package cn.iocoder.yudao.module.system.controller.admin.queryscene.vo;

import cn.hutool.core.collection.ListUtil;
import cn.iocoder.yudao.framework.mybatis.core.enums.QueryCondition;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Schema(description = "管理后台 - 高级查询场景 Response VO")
@Data
public class QuerySceneBaseVO {

    // 字段名
    private String field;

    // 字段中文名称
    private String fieldName;

    // 查询类型: string, number, time, select
    private List<String> queryType;

    private Map<Object, Object> queryOptions; // 提供的查询选项, 类似于行业\ 地区\ 等

    // 字段类型: input,select,timepicker input-number

    private String fieldType;




    // 构建查询类型: 等于\不等于\包含\不包含\模糊查询\空\非空
    public static List<String> buildDefaultQueryType() {
        return ListUtil.toList(
                QueryCondition.EQ,
                QueryCondition.NEQ,
                QueryCondition.IN,
                QueryCondition.NIN,
                QueryCondition.LIKE,
                QueryCondition.IS_NULL,
                QueryCondition.IS_NOT_NULL
        );
    }

    public static List<String> buildDefaultQueryType2() {
        return ListUtil.toList(
                QueryCondition.EQ,
                QueryCondition.NEQ,
                QueryCondition.IN,
                QueryCondition.NIN,
                QueryCondition.IS_NULL,
                QueryCondition.IS_NOT_NULL
        );
    }

    // 构建等于\不等于的查询
    public static List<String> buildEQQueryType() {
        return ListUtil.toList(
                QueryCondition.EQ,
                QueryCondition.NEQ
        );
    }

    // 构建时间类型的,大于等于小于等于, 区间
    public static List<String> buildRangeQueryType() {
        return ListUtil.toList(
                QueryCondition.GT,
                QueryCondition.GTE,
                QueryCondition.LT,
                QueryCondition.LTE,
                QueryCondition.BETWEEN
        );
    }

}